<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>简易图片轮播</title>
</head>

<body>
    <div class="container">
        <img src="../img/pug1.jpg" alt="pug">
    </div>
    <script>
        let arr = ["pug1.jpg", "pug2.jpg", "pug3.jpg", "pug4.jpg"];
        let image = document.querySelector("img");

        let i = 0;

        setInterval(function () {
            if (i == arr.length) {
                i = 0;
            }
            image.src = `../img/${arr[i]}`;
            i++;
        }, 1000);

        


    </script>
</body>

</html>